﻿@using Utils
@using LuxDiner.Model.Orders
@model LuxDiner.Model.Orders.DealOrderModel
@{
    ViewBag.Title = "Print";
    Layout = null;
}
<link href="@Url.Content("/content/styles/print_order.css")" type="text/css" rel="stylesheet" />

<div class="print">
    <table>
        <tr>
            <td class="main">
                <div class="top">
                    <b>鼎宴食品（喜力配送中心）
                    (@LuxDiner.Web.Management.Common.GetOrderName(Model.Method))
                    </b>
                </div>
                <div class="banner">
                    <table>
                        <tr>
                            <td colspan="3">
                                <b>往来单位：</b>@Model.Customer.Corporation
                                &nbsp;
                                @if (Model.Method == (int)OrderMethod.XS)
                                {
                                    <span>@(Model.Delivers)</span>
                                }
                            </td>
                        </tr>
                        @if (!string.IsNullOrEmpty(Model.Description))
                        {
                            <tr>
                                <td colspan="3">
                                    <b>备注：</b>@Model.Description
                                </td>
                            </tr>    
                        }
                        <tr>
                            <td style="width: 30%"><b>累计应收：</b>@(string.Format("{0:c2}", ViewBag.RemainPay))</td>
                            <td style="width: 40%"><b>单据日期：</b>@Model.NoteDate.ToString("yyyy年MM月dd日")</td>
                            <td style="width: 30%"><b>NO：</b>@Model.OrderNo</td>
                        </tr>
                        
                    </table>
                </div>
                <div class="body">
                    <table>
                        <tr class="title">
                            <td style="width: 5%">序号</td>
                            <td style="width: 40%">商品名</td>
                            <td style="width: 10%">数量</td>
                            <td style="width: 13%">辅助数量</td>
                            <td style="width: 10%">单价</td>
                            <td style="width: 12%">金额</td>
                        </tr>
                        @for (var i=0;i<Model.Items.Count;i++)
                        {
                            var item = Model.Items[i];
                            <tr>
                                <td style="text-align: center">@(i+1)</td>
                                <td>@item.Product.ProductName</td>
                                <td style="text-align: center">@(string.Format("{0}({1})", item.Quantity.ToString().RemoveLastZero(), item.Product.UnitName))</td>
                                <td style="text-align: center">@item.AssistantQuantity</td>
                                <td style="text-align: right">@item.UnitPrice.ToString().RemoveLastZero(2)</td>
                                <td style="text-align: right">@(string.Format("{0:c2}", item.Quantity * item.UnitPrice))</td>
                            </tr>
                        }
                        <tr>
                            <td colspan="4"><b>总金额(大写)：</b>¥ @ChineseNum.GetUpperMoney((double)Model.TotalMoney)</td>
                            <td colspan="2" style="text-align: right"><b>总计：</b>@(string.Format("{0:c2}", Model.TotalMoney))</td>
                        </tr>
                    </table>
                </div>

                @if (Model.Method == (int)OrderMethod.XS)
                {
                    <div class="foot">
                        <table>
                            <tr>
                                <td colspan="2"><b>地址：</b></td>
                                <td><b>电话：</b>13505771128</td>
                                <td>口现金 &nbsp;&nbsp;&nbsp;口转帐</td>
                                <tr><td colspan="4"><b>汇款</b> 农行:6228480338323309777(林小和)</td>
                            </tr>
                            <tr>
                                <td style="width: 25%"><b>制单：</b>@LuxDiner.Web.Global.WebContext.CurrentUser.RealName</td>
                                <td style="width: 25%"><b>配货：</b></td>
                                <td style="width: 25%"><b>送货：</b></td>
                                <td style="width: 25%"><b>签收：</b></td>
                            </tr>
                        </table>
                    </div>    
                }
            </td>
            <td class="side">
                <div>白(存)</div>
                <div>红(客)</div>
                <div>蓝(库)</div>
                <div>黄(记)</div>
            </td>
        </tr>
    </table>
    <div id="bt">
        <input type="button" value="打 印" onclick="Print()" />
    </div>
</div>

<script>
    function Print() {
        var obj = document.getElementById("bt");
        obj.parentNode.removeChild(obj);
        window.print();
    }
</script>

